package com.example;

import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.ollama.OllamaChatModel;
import org.springframework.ai.tool.ToolCallbackProvider;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class OllamaConfig {

    @Value("${ai.user.input}")
    private String userInput;

    @Bean
    public ChatClient chatClient(OllamaChatModel ollamaChatModel, ToolCallbackProvider tools) {
        ChatClient.Builder builder = ChatClient.builder(ollamaChatModel);
        var chatClient = builder
                .defaultToolCallbacks(tools)
                .build();
        return chatClient;
    }
}